package day16;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;

public class arrayListPractice {
    public static void main(String[] args) {
        List<Integer> list=new ArrayList<>();
        list.add(100);
        list.add(200);
        list.add(300);
        list.add(300);
        list.add(400);
        list.add(500);
        System.out.println(list);
        System.out.println(list.remove(Integer.valueOf(300)));
        System.out.println(list);
        System.out.println(list.set(2,3000));
        System.out.println(list);
        System.out.println(list.indexOf(400));//3
        System.out.println(list.get(3));
        System.out.println(list.isEmpty());//false
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }
        for (Integer e:list){
            System.out.println(e);
        }
        System.out.println("************");
        Iterator<Integer> it1 = list.iterator();
        while (it1.hasNext()){
            System.out.println(it1.next());
        }
        System.out.println("************");
        ListIterator<Integer> it2 = list.listIterator();
        while (it2.hasNext()){
            System.out.println(it2.next());
        }
    }
}
